import { createApp } from 'vue'
import { createPinia } from 'pinia'
import router from './router'
import App from './App.vue'

const parseParams = () => {
    let paramsStr = (window.location.href.split('?')[1] || '').split('#')[0]
    let paramsArr = paramsStr.split('&')
    let params = {}
    paramsArr.forEach(item => {
        let arr = item.split('=')
        params[arr[0]] = arr[1]
    })
    return params
}

const params = parseParams()

window.outerParams = params

const app = createApp(App)
const pinia = createPinia()



app.use(pinia)
app.use(router)
app.mount('#app')

if (window.outerParams.deskCode) {
    router.push('/table')
} else {
    router.push('/menu')
}